<?php

/**
 * ItemCompraInternacional form base class.
 *
 * @method ItemCompraInternacional getObject() Returns the current form's model object
 *
 * @package    dirsac
 * @subpackage form
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseItemCompraInternacionalForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'articulo_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Articulo'), 'add_empty' => false)),
      'compra_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompraInternacional'), 'add_empty' => false)),
      'cantidad'            => new sfWidgetFormInputText(),
      'costo_neto_unitario' => new sfWidgetFormInputText(),
      'subtotal'            => new sfWidgetFormInputText(),
      'observacion'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'articulo_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Articulo'))),
      'compra_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CompraInternacional'))),
      'cantidad'            => new sfValidatorInteger(array('required' => false)),
      'costo_neto_unitario' => new sfValidatorNumber(),
      'subtotal'            => new sfValidatorInteger(array('required' => false)),
      'observacion'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('item_compra_internacional[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ItemCompraInternacional';
  }

}
